package com.lookpoint.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {
    // 基本介绍信息
    private ApiInfo apiInfo() {
        //配置基本信息
        Contact LookPoint = new Contact("wheely", "http://www.lookpoint.com/", "wheely@foxemail");
        return new ApiInfoBuilder()
                //标题
                .title("看点资讯")
                .description("开发接口文档")
                //基本信息
                .contact(LookPoint)
                //版本号
                .version("1.0.0")
                //创建
                .build();
    }
    // 配置信息
    @Bean("defaultApi")
    public Docket defaultApi() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.lookpoint.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
